package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.feign.product.IndexFeignClient;
import com.atguigu.gmall.feign.product.Person;
import com.atguigu.gmall.model.web.WebCategoryAllVo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 钟涛
 * @version 1.0
 * @description: TODO
 * @date 2021/12/10 10:45
 */
@Controller
public class IndexController {
    @Autowired
    private IndexFeignClient indexFeignClient;

    @GetMapping("/")
    public String indexPage(Model model) {
        //给首页查询到三级分类的数据
        List<WebCategoryAllVo> categoryAll = indexFeignClient.getCategoryAll();
        model.addAttribute("list", categoryAll);
        return "index/index";
    }

//    @GetMapping("/zbt")
//    public String zbt() {
//        //给首页查询到三级分类的数据
//        Person person = new Person();
//        person.setId(1001L);
//        person.setName("sll");
//        person.setAge(23);
//        List<Date> dateList = new ArrayList<>();
//        dateList.add(new Date());
//        person.setPointDate(dateList);
//        indexFeignClient.getZBT(person);
//        return "index/index";
//    }
}
